package com.lovo.homework;

import com.lovo.lesson.Student;

import java.util.HashMap;
import java.util.Map;

public class Homework01 {
    public static void main(String[] args) {
        Map<Integer,Student> map = new HashMap<Integer, Student>();
//        map.put(1, "Amy");
//        map.put(2, "Joe");
        map.put(3, new Student("Tom",20,"男"));
//        map.put(4, "Susan");

        Student stu = map.get(3);
        stu.setName("Tommy");

        System.out.println(map);

        String [] strs = {"a", "b", "a", "b", "c", "a", "b", "c", "b"};
        HashMap<String,Integer> hashMap = new HashMap();
        for(int i = 0;i < strs.length;i++){
            if(hashMap.containsKey(strs[i])){
                int v = hashMap.get(strs[i]);
                hashMap.put(strs[i],++v);

            }else{
                hashMap.put(strs[i],1);
            }
        }
        System.out.println(hashMap);

    }
}
